﻿using System;
using System.ComponentModel;

namespace N2.ComponentModel
{
	/// <summary>
	/// Used to apply <c cref="JsonContentItemTypeDescriptor" /> to a ContentItem type
	/// </summary>
	class JsonContentItemTypeDescriptionProvider : TypeDescriptionProvider
	{
		#region ctor

		public JsonContentItemTypeDescriptionProvider(TypeDescriptionProvider parent)
			: base(parent) { }

		public JsonContentItemTypeDescriptionProvider()
			: this(TypeDescriptor.GetProvider(typeof(ContentItem)))
		{
		}

		#endregion ctor

		#region Methods

		public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
		{
			return new JsonContentItemTypeDescriptor(
				base.GetTypeDescriptor(objectType, instance));
		}

		#endregion Methods
	}
}
